<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Registrazione</title>
</h:head>
<h:body>
	<table class="modulo" align="center">
		<tr>
			<td><h:form id="regForm">
					<p:panel header="Modulo di Registrazione">
						<h:panelGrid columns="3" id="regGrid">
							<h:outputLabel for="username">Username:</h:outputLabel>
							<p:inputText id="username" value="#{registerBean.user.username}">
								<p:ajax event="click" update="msgFail" />
							</p:inputText>
							<p:message id="msgUsername" for="username" />

							<h:outputLabel for="password">Password:</h:outputLabel>
							<p:password id="password" value="#{registerBean.user.password}"
								feedback="true" match="pwd2" label="Password" />
							<p:message id="msgPwd" for="password" />

							<h:outputLabel for="pwd2">Conferma Password:</h:outputLabel>
							<p:password id="pwd2" label="Conferma Password"
								value="#{registerBean.user.password}" />
							<h:outputLabel></h:outputLabel>

							<h:outputLabel for="nome">Nome:</h:outputLabel>
							<p:inputText id="nome" value="#{registerBean.user.nome}" />
							<p:message id="msgNome" for="nome" />

							<h:outputLabel for="cognome">Cognome:</h:outputLabel>
							<p:inputText id="cognome" value="#{registerBean.user.cognome}" />
							<p:message id="msgCognome" for="cognome" />

							<h:outputLabel for="email">Email:</h:outputLabel>
							<p:inputText id="email" value="#{registerBean.user.email}" />
							<p:message id="msgEmail" for="email" />
						</h:panelGrid>
						<br />
						<p:button outcome="home" value="Indietro" icon="ui-icon-home" />
						<p:commandButton id="regSubmit" value="Conferma"
							update="regGrid, msgFail"
							action="#{registerBean.registraCliente()}"
							icon="ui-icon-carat-1-e" iconPos="right" />
						<p:messages id="msgFail" showDetail="true" autoUpdate="false"
							closable="true" for="regSubmit" />
					</p:panel>
				</h:form></td>
		</tr>
	</table>

</h:body>
</html>